﻿using System;
using System.Collections.Generic;
using System.Text;
using Abp.Runtime.Session;
using Abp.Timing.Timezone;
using JYJ.AiYard.DataExporting.Excel.Epplus;
using JYJ.AiYard.DataFileObjects.DataTempCache;
using JYJ.AiYard.StationManagement.TbYardIssuedCards;
using JYJ.AiYard.StationManagement.TbYardIssuedCards.Dtos;
using JYJ.AiYard.StationManagement.YardReport;
using L._52ABP.Application.Dtos;

namespace JYJ.AiYard.StationManagement.Exporting
{
    public class ListExcelExporter : EpplusExcelExporterBase, IListExcelExporter
    {
        #region 构造函数
        private readonly ITimeZoneConverter _timeZoneConverter;

        public ListExcelExporter(IDataTempFileCacheManager dataTempFileCacheManager, ITimeZoneConverter timeZoneConverter) : base(
            dataTempFileCacheManager)
        {
            _timeZoneConverter = timeZoneConverter;
        }
        #endregion

        #region 车辆管理
        /// <summary>
        /// 车辆管理
        /// </summary>
        /// <param name="tbYardIssuedCardDbDtos"></param>
        /// <returns></returns>
        public FileDto ExportToExcelByYardIssuedCard(List<TbYardIssuedCardDb> tbYardIssuedCardDbDtos)
        {
            var excel =
                CreateExcelPackage("YardIssuedCard.xlsx", excelpackage =>
                {
                    var sheet = excelpackage.Workbook.Worksheets.Add(L("TbYardIssuedCard"));

                    sheet.OutLineApplyStyle = true;

                    AddHeader(sheet,
                        "场所",
                        "包月类型",  //卡类
                        "姓名",
                        "部门",
                        "手机",
                        "车牌号码",
                        "有效期",
                        "收费金额",
                        "车牌颜色",
                        "车辆颜色",
                        "证件号码",
                        "机号");

                    AddObject(sheet, 2, tbYardIssuedCardDbDtos,
                        ex => ex.Station_ID,
                        ex => ex.CardTypeId,
                        ex => ex.User_Name,
                        ex => ex.Depart_Name,
                        ex => ex.Phone, 
                        ex => ex.CardNo,
                        ex => ex.EndTime,
                        ex => ex.PayMoney, 
                        ex => ex.PlateColor,
                        ex => ex.CarColor,
                        ex => ex.IDNO,
                        ex => ex.Card_IOPower); 
                    var EndTime = sheet.Column(7);
                    EndTime.Style.Numberformat.Format = "yyyy-MM-dd"; 

                     
                });



            return excel;
        }
        #endregion

        #region 车辆进场数据导出
        /// <summary>
        /// 车辆进场数据导出
        /// </summary>
        /// <param name="tbrInYard"></param>
        /// <returns></returns>
        public FileDto ExportToExcelByTbrInYard(List<TbrInYard> tbrInYard)
        {
            var excel =
                CreateExcelPackage("车辆进场数据查询.xlsx", excelpackage =>
                {
                    var sheet = excelpackage.Workbook.Worksheets.Add(L("TbrInYard"));

                    sheet.OutLineApplyStyle = true;

                    AddHeader(sheet,
                        "进场编号",
                        "车辆类型",
                        "车牌号码",
                        //"车牌颜色",
                        "进场时间",
                        "进场通道",
                        "车主姓名",
                        "进场备注",
                        "操作用户",
                        "小车场",
                        "电脑名称",
                        "车辆颜色",
                        "车牌颜色",
                        "车辆型号",
                        "车牌类型",
                        "特权车类型",
                        "场内车"
                       );

                    AddObject(sheet, 2, tbrInYard,
                        ex => ex.tIN_ID,
                        ex => ex.tIN_CardType_Name,
                        ex => ex.tIN_CardNo,
                        //ex => ex.tIN_Plate_Color,
                        ex => ex.tIN_Time,
                        ex => ex.tIN_Mach_Name,
                        ex => ex.tIN_UserName,
                        ex => ex.tIN_Image5,
                        ex => ex.tIN_Op_Name,
                        ex => ex.tIN_Small,
                        ex => ex.tIN_Client_ID,
                        ex => ex.tCar_Color,
                        ex => ex.tPlate_Color,
                        ex => ex.tCar_Type,
                        ex => ex.tPlate_Type,
                        ex => ex.tisPrivilege,
                        ex => ex.tInYard
                        );
                 
                    var tIN_Time = sheet.Column(4);
                    tIN_Time.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";


                    //ex => _timeZoneConverter.Convert(ex.CreationTime, AbpSession.TenantId, AbpSession.GetUserId()));



                    //var createTimeColumn = sheet.Column(3);
                    //createTimeColumn.Style.Numberformat.Format = "yyyy-mm-dd";
                });



            return excel;
        }
        #endregion

        #region 车辆出场数据导出
        /// <summary>
        /// 车辆出场数据导出
        /// </summary>
        /// <param name="tbrInYard"></param>
        /// <returns></returns>
        public FileDto ExportToExcelByTbrOutYard(List<TbrOutYard> tbrOutYard)
        {
            var excel =
                CreateExcelPackage("车辆出场数据查询.xlsx", excelpackage =>
                {
                    var sheet = excelpackage.Workbook.Worksheets.Add(L("TbrOutYard"));

                    sheet.OutLineApplyStyle = true;

                    AddHeader(sheet,
                        "出场编号",
                        "收费类型",
                        "车牌号码",
                        //"车牌颜色",
                        "进场时间",
                        "出场时间",
                        "停车时间",
                        "进场通道",
                        "出场通道",
                        "车主姓名",
                        "进场操作员",
                        "出场操作员",
                        "进场备注",
                        "出场备注",
                        "小车场",
                        "出场电脑名",
                        "车辆颜色",
                        "车牌颜色",
                        "车辆类型",
                        "车牌类型",
                        "特权车类型",
                        "充电减免(分钟)",
                        "应收",
                        "免单",
                        "积分抵扣",
                        "公交卡",
                        "支付宝",
                        "微信",
                        "银联",
                        "龙支付",
                        "现金",
                        "钱包"
                       );

                    AddObject(sheet, 2, tbrOutYard,
                        ex => ex.tOut_ID,
                        ex => ex.tOut_CardType_Name,
                        ex => ex.tOut_CardNo,
                        //ex => ex.tOut_Plate_Color,
                        ex => ex.tIN_Time,
                        ex => ex.tOut_Time,
                        ex => ex.tStopTime,
                        ex => ex.tIN_Mach_Name,
                        ex => ex.tOUT_Mach_Name,
                        ex => ex.tOut_UserName,
                        ex => ex.tIN_Op_Name, 
                        ex => ex.tOut_Op_Name,
                        ex => ex.tIN_Image5,
                        ex => ex.tOut_Image5,
                        ex => ex.tOut_Small,
                        ex => ex.tOut_Client_ID,
                        ex => ex.tCar_Color,
                        ex => ex.tPlate_Color,
                        ex => ex.tCar_Type,
                        ex => ex.tPlate_Type,
                        ex => ex.tisPrivilege,
                        ex => ex.duration,
                        ex => ex.tRecv_Amt,
                        ex => ex.tFree_Amt,
                        ex => ex.tVIP_Amt,
                        ex => ex.tBus_Amt,
                        ex => ex.tAlipay_Amt,
                        ex => ex.tQQ_Amt,
                        ex => ex.tBank_Amt,
                        ex => ex.tLong_Amt,
                        ex => ex.tPaid_Amt,
                        ex => ex.tAccount_Amt
                    );

                    var tIN_Time = sheet.Column(4);
                    tIN_Time.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";

                    var tOut_Time = sheet.Column(5);
                    tOut_Time.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";
 
                });



            return excel;
        }
        #endregion

        #region 车辆开闸数据导出
        /// <summary>
        /// 车辆开闸数据导出
        /// </summary>
        /// <param name="tbrOpenGate"></param>
        /// <returns></returns>
        public FileDto ExportToExcelByTbrOpenGate(List<TbrOpenGate> tbrOpenGate)
        {
            var excel =
                CreateExcelPackage("车辆开闸数据查询.xlsx", excelpackage =>
                {
                    var sheet = excelpackage.Workbook.Worksheets.Add(L("TbrOpenGate"));

                    sheet.OutLineApplyStyle = true;

                    AddHeader(sheet,
                        "记录编号",
                        "开闸时间",
                        "通道",
                        "操作人员"
                       );

                    AddObject(sheet, 2, tbrOpenGate,
                        ex => ex.tOpen_Id,
                        ex => ex.tOpen_Time,
                        ex => ex.tMach_Name,
                        ex => ex.tOp_Name
                    );

                    var tOpen_Time = sheet.Column(2);
                    tOpen_Time.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";
                });



            return excel;
        }
        #endregion

        #region 发行车牌数据导出
        /// <summary>
        /// 发行车牌数据导出
        /// </summary>
        /// <param name="tbrIssued"></param>
        /// <returns></returns>
        public FileDto ExportToExcelByTbrIssued(List<TbrIssued> tbrIssued)
        {
            var excel =
                CreateExcelPackage("车辆发行数据查询.xlsx", excelpackage =>
                {
                    var sheet = excelpackage.Workbook.Worksheets.Add(L("TbrIssued"));

                    sheet.OutLineApplyStyle = true;

                    AddHeader(sheet,
                        "发行编号",
                        "车主代码",
                        "车主姓名",
                        "车主电话",
                        "部门",
                        "车牌",
                        "车牌颜色",
                        "包月类型",
                        "状态",
                        "有效起日",
                        "有效止日",
                        "剩余天数",
                        "车辆颜色",
                        "车型",
                        "行驶证",
                        "备注"
                    );

                    AddObject(sheet, 2, tbrIssued,
                        ex => ex.Id,
                        ex => ex.User_No,
                        ex => ex.User_Name,
                        ex => ex.User_Mobile,
                        ex => ex.Depart_Name,
                        ex => ex.CardNo,
                        ex => ex.PlateColor,
                        ex => ex.CardTypeName,
                        ex => ex.Status,
                        ex => ex.BeginTime,
                        ex => ex.EndTime,
                        ex => ex.Y_Day,
                        ex => ex.CarColor,
                        ex => ex.CarType,
                        ex => ex.IDNO,
                        ex => ex.Memo
                    );

                    var BeginTime = sheet.Column(10);
                    BeginTime.Style.Numberformat.Format = "yyyy-MM-dd";
                    var EndTime = sheet.Column(11);
                    EndTime.Style.Numberformat.Format = "yyyy-MM-dd";
                });



            return excel;
        }
        #endregion

        #region 车牌操作数据导出
        /// <summary>
        /// 车牌操作数据导出
        /// </summary>
        /// <param name="tbrIssuedOpCard"></param>
        /// <returns></returns>
        public FileDto ExportToExcelByTbrIssuedOpCard(List<TbrIssuedOpCard> tbrIssuedOpCard)
        {
            var excel =
                CreateExcelPackage("车辆操作报表.xlsx", excelpackage =>
                {
                    var sheet = excelpackage.Workbook.Worksheets.Add(L("TbrIssuedOpCard"));

                    sheet.OutLineApplyStyle = true;

                    AddHeader(sheet,
                        "操作编号",
                        "车主代码",
                        "车主姓名",
                        "部门",
                        "车牌",
                        "原车牌",
                        "车牌颜色",
                        "包月类型",
                        "状态",
                        "旧有效起日",
                        "旧有效止日",
                        "新有效起日",
                        "新有效止日",
                        "操作类型",
                        "操作时间",
                        "操作员账号",
                        "操作员姓名",
                        "金额",
                        "算费类型",
                        "操作值",
                        "优惠金额",
                        "车辆颜色",
                        "车型",
                        "行驶证",
                        "备注"
                    );

                    AddObject(sheet, 2, tbrIssuedOpCard,
                        ex => ex.Id,
                        ex => ex.User_No,
                        ex => ex.User_Name,
                        ex => ex.Depart_Name,
                        ex => ex.CardNo,
                        ex => ex.Card_CarNO,
                        ex => ex.PlateColor,
                        ex => ex.CardTypeName,
                        ex => ex.Status,
                        ex => ex.Old_BTime,
                        ex => ex.Old_ETime,
                        ex => ex.New_BTime,
                        ex => ex.New_ETime,
                        ex => ex.Op_Type,
                        ex => ex.Op_Time,
                        ex => ex.Op_User_NO,
                        ex => ex.OP_User_Name,
                        ex => ex.Amount,
                        ex => ex.YQ_Type,
                        ex => ex.YQ_Value,
                        ex => ex.YH_Amount,
                        ex => ex.CarColor,
                        ex => ex.CarType,
                        ex => ex.IDNO,
                        ex => ex.Memo
                    );

                    var Old_BTime = sheet.Column(10);
                    Old_BTime.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";
                    var Old_ETime = sheet.Column(11);
                    Old_ETime.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";

                    var New_BTime = sheet.Column(12);
                    New_BTime.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";
                    var New_ETime = sheet.Column(13);
                    New_ETime.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";

                    var Op_Time = sheet.Column(15);
                    Op_Time.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";
                });



            return excel;
        }
        #endregion

        #region 停车券明细数据导出
        /// <summary>
        /// 停车券明细数据导出
        /// </summary>
        /// <param name="tbrDiscount"></param>
        /// <returns></returns>
        public FileDto ExportToExcelByTbrDiscount(List<TbrDiscount> tbrDiscount)
        {
            var excel =
                CreateExcelPackage("停车券明细报表.xlsx", excelpackage =>
                {
                    var sheet = excelpackage.Workbook.Worksheets.Add(L("TbrDiscount"));

                    sheet.OutLineApplyStyle = true;

                    AddHeader(sheet,
                        "记录号",
                        "券号",
                        "商户编号",
                        "商户名称",
                        "支付状态",
                        "支付时间",
                        "券名称",
                        "抵扣类型",
                        "抵扣值",
                        "有效期",
                        "领取状态",
                        "领取人",
                        "领取时间",
                        "车牌号码",
                        "使用状态",
                        "使用时间",
                        "抵扣金额",
                        "进场编号" 
                    );

                    AddObject(sheet, 2, tbrDiscount,
                        ex => ex.Id,
                        ex => ex.tBillNo,
                        ex => ex.tSaleNo,
                        ex => ex.tSaleName,
                        ex => ex.tsalePayStatusName,
                        ex => ex.tsalePayTime,
                        ex => ex.tBillName,
                        ex => ex.tDeduType,
                        ex => ex.tDeduValue,
                        ex => ex.tExdt,
                        ex => ex.trecvStatus,
                        ex => ex.trecvOpenId,
                        ex => ex.trecvTime,
                        ex => ex.trecvUserName,
                        ex => ex.tUseStatusName,
                        ex => ex.tUseTime,
                        ex => ex.tFree_Amt,
                        ex => ex.trecordId
                    );

                    var Old_BTime = sheet.Column(6);
                    Old_BTime.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";
                    var Old_ETime = sheet.Column(10);
                    Old_ETime.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";

                    var New_BTime = sheet.Column(13);
                    New_BTime.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";
                    var New_ETime = sheet.Column(16);
                    New_ETime.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss"; 

                });



            return excel;
        }
        #endregion

        #region 交班统计数据导出
        /// <summary>
        /// 交班统计数据导出
        /// </summary>
        /// <param name="tbrChangeClass"></param>
        /// <returns></returns>
        public FileDto ExportToExcelByTbrChangeClass(List<TbrChangeClass> tbrChangeClass)
        {
            var excel =
                CreateExcelPackage("交班统计报表.xlsx", excelpackage =>
                {
                    var sheet = excelpackage.Workbook.Worksheets.Add(L("TbrChangeClass"));

                    sheet.OutLineApplyStyle = true;

                    AddHeader(sheet,
                        "班次编号",
                        "客户端名称",
                        "上班日期",
                        "操作员",
                        "接班人",
                        "应收",
                        "停车券(线上)",
                        "停车券(线下)",
                        "本地免单",
                        "积分抵扣(线上)",
                        "积分抵扣(线下)",
                        "公交卡(线上)",
                        "公交卡(线下)",
                        "支付宝(线上)",
                        "支付宝(线下)",
                        "微信(线上)",
                        "微信(线下)",
                        "苹果支付(线上)",
                        "苹果支付(线下)",
                        "银联(线上)",
                        "银联(线下)",
                        "龙支付(线上)",
                        "龙支付(线下)",
                        "钱包(线上)",
                        "钱包(线下)",
                        "现金"
                    );

                    AddObject(sheet, 2, tbrChangeClass,
                        ex => ex.tOut_Class_ID,
                        ex => ex.Client_Name,
                        ex => ex.LoginDate,
                        ex => ex.UserName,
                        ex => ex.JUserName,
                        ex => ex.tRecv_Amt,
                        ex => ex.online_Free,
                        ex => ex.offline_Free,
                        ex => ex.local_Free,
                        ex => ex.online_VIP,
                        ex => ex.offline_VIP,
                        ex => ex.online_Bus,
                        ex => ex.offline_Bus,
                        ex => ex.online_Alipay,
                        ex => ex.offline_Alipay,
                        ex => ex.online_QQ,
                        ex => ex.offline_QQ,
                        ex => ex.online_Apple,
                        ex => ex.offline_Apple,
                        ex => ex.online_Bank,
                        ex => ex.offline_Bank,
                        ex => ex.online_Long,
                        ex => ex.offline_Long,
                        ex => ex.online_Account,
                        ex => ex.offline_Account,
                        ex => ex.tPaid_Amt
                    );

                    var LoginDate = sheet.Column(2);
                    LoginDate.Style.Numberformat.Format = "yyyy-MM-dd"; 

                });



            return excel;
        }
        #endregion

        #region 收费统计数据导出
        /// <summary>
        /// 收费统计数据导出
        /// </summary>
        /// <param name="tbrStatics"></param>
        /// <returns></returns>
        public FileDto ExportToExcelByTbrStatics(List<TbrStatics> tbrStatics, string Staticstype)
        {
            string Y = "月";
            string D = Staticstype;
            if (Staticstype == "周" || Staticstype == "月")
            {
                 Y = "年"; 
            } 
            var excel =
                CreateExcelPackage("收费统计报表按"+ D + ".xlsx", excelpackage =>
                {
                    var sheet = excelpackage.Workbook.Worksheets.Add(L("TbrStatics"));

                    sheet.OutLineApplyStyle = true;

                    AddHeader(sheet,
                        Y,
                        D,
                        "应收",
                        "停车券(线上)",
                        "停车券(线下)",
                        "本地免单",
                        "积分抵扣(线上)",
                        "积分抵扣(线下)",
                        "公交卡(线上)",
                        "公交卡(线下)",
                        "支付宝(线上)",
                        "支付宝(线下)",
                        "微信(线上)",
                        "微信(线下)",
                        "苹果支付(线上)",
                        "苹果支付(线下)",
                        "银联(线上)",
                        "银联(线下)",
                        "龙支付(线上)",
                        "龙支付(线下)",
                        "钱包(线上)",
                        "钱包(线下)",
                        "现金"
                    );

                    AddObject(sheet, 2, tbrStatics,
                        ex => ex.Y,
                        ex => ex.D, 
                        ex => ex.tRecv_Amt,
                        ex => ex.online_Free,
                        ex => ex.offline_Free,
                        ex => ex.local_Free,
                        ex => ex.online_VIP,
                        ex => ex.offline_VIP,
                        ex => ex.online_Bus,
                        ex => ex.offline_Bus,
                        ex => ex.online_Alipay,
                        ex => ex.offline_Alipay,
                        ex => ex.online_QQ,
                        ex => ex.offline_QQ,
                        ex => ex.online_Apple,
                        ex => ex.offline_Apple,
                        ex => ex.online_Bank,
                        ex => ex.offline_Bank,
                        ex => ex.online_Long,
                        ex => ex.offline_Long,
                        ex => ex.online_Account,
                        ex => ex.offline_Account,
                        ex => ex.tPaid_Amt
                    );
                     

                });



            return excel;
        }
        #endregion

        #region 在线支付数据导出
        /// <summary>
        /// 在线支付数据导出
        /// </summary> 
        /// <returns></returns>
        public FileDto ExportToExcelByTbrOnlinePay(List<TbrOnlinePay> tbrOnlinePay)
        {
             
            var excel =
                CreateExcelPackage("在线支付.xlsx", excelpackage =>
                {
                    var sheet = excelpackage.Workbook.Worksheets.Add(L("TbrOnlinePay"));

                    sheet.OutLineApplyStyle = true;

                    AddHeader(sheet,
                        "记录编号", 
                        "商户号",
                        "商户名称",
                        "支付金额",
                        "订单号码",
                        "交易订单",
                        "订单时间",
                        "交易时间",
                        "支付服务商",
                        "支付方式",
                        "交易状态",
                        "错误代码",
                        "错误说明",
                        "记录时间",
                        "子系统",
                        "关联记录",
                        "车牌号码",
                        "场内车辆",
                        "进场时间" 
                    );

                    AddObject(sheet, 2, tbrOnlinePay,
                        ex => ex.trade_id,
                        ex => ex.shops_id,
                        ex => ex.shops_name,
                        ex => ex.total_amount,
                        ex => ex.out_trade_no,
                        ex => ex.trade_no,
                        ex => ex.gmt_create,
                        ex => ex.gmt_payment,
                        ex => ex.trade_type,
                        ex => ex.trade_code,
                        ex => ex.trade_status,
                        ex => ex.return_code,
                        ex => ex.return_msg,
                        ex => ex.datatime,
                        ex => ex.source,
                        ex => ex.recordid,
                        ex => ex.plateNo,
                        ex => ex.InYard,
                        ex => ex.IN_Time 
                    );
                    var gmt_create = sheet.Column(7);
                    gmt_create.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";
                    var gmt_payment = sheet.Column(8);
                    gmt_payment.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";

                    var datatime = sheet.Column(14);
                    datatime.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";
                    var IN_Time = sheet.Column(19);
                    IN_Time.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";
                     

                });



            return excel;
        }
        #endregion

        #region 在线支付数据导出
        /// <summary>
        /// 开票结果数据导出
        /// </summary> 
        /// <returns></returns>
        public FileDto ExportToExcelByTbrInvoice(List<TbrInvoice> tbrInvoice)
        {

            var excel =
                CreateExcelPackage("开票结果.xlsx", excelpackage =>
                {
                    var sheet = excelpackage.Workbook.Worksheets.Add(L("TbrInvoice"));

                    sheet.OutLineApplyStyle = true;

                    AddHeader(sheet,
                        "订单号码",
                        "订单日期",
                        "购买方名称",
                        "购买方纳税人编号",
                        "购买方手机号码",
                        "购买方邮箱地址",
                        "物品名称",
                        "物品单价",
                        "物品金额",
                        "税率",
                        "税额",
                        "回调代码",
                        "回调说明",
                        "请求时间",
                        "回调时间" 
                    );

                    AddObject(sheet, 2, tbrInvoice,
                        ex => ex.DDLSH,
                        ex => ex.DDRQ,
                        ex => ex.GHFMC,
                        ex => ex.GHF_NSRSBH,
                        ex => ex.GHF_SJ,
                        ex => ex.GHF_EMAIL,
                        ex => ex.XMMC,
                        ex => ex.XMDJ,
                        ex => ex.XMJE,
                        ex => ex.SL,
                        ex => ex.SE,
                        ex => ex.returnCode,
                        ex => ex.returnMessage,
                        ex => ex.CreateTime,
                        ex => ex.returnTime 
                    );
                    var gmt_create = sheet.Column(2);
                    gmt_create.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";
                    var gmt_payment = sheet.Column(14);
                    gmt_payment.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";

                    var datatime = sheet.Column(15);
                    datatime.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss"; 


                });



            return excel;
        }
        #endregion

        #region 路政对账单数据导出
        /// <summary>
        /// 在线支付数据导出
        /// </summary> 
        /// <returns></returns>
        public FileDto ExportToExcelByrRoadPayResults(List<rRoadPayResults> rrRoadPayResults)
        {

            var excel =
                CreateExcelPackage("上海停车对账单.xlsx", excelpackage =>
                {
                    var sheet = excelpackage.Workbook.Worksheets.Add(L("rRoadPayResults"));

                    sheet.OutLineApplyStyle = true;

                    AddHeader(sheet,
                        "停车业务号",
                        "支付订单号",
                        "支付金额",
                        "支付时间",
                        "支付类型",
                        "订单创建时间",
                        "车牌号码",
                        "进场时间",
                        "出场时间",
                        "出场编号",
                        "进场编号" 
                    );

                    AddObject(sheet, 2, rrRoadPayResults,
                        ex => ex.bussinessId,
                        ex => ex.orderId,
                        ex => ex.payMoney,
                        ex => ex.payTime,
                        ex => ex.payType,
                        ex => ex.gmt_create,
                        ex => ex.tOut_CardNO,
                        ex => ex.tIN_Time,
                        ex => ex.tOut_Time,
                        ex => ex.tOut_Id,
                        ex => ex.tIN_Id 
                    );
                    var payTime = sheet.Column(4);
                    payTime.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";
                    var gmt_create = sheet.Column(6);
                    gmt_create.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";

                    var tIN_Time = sheet.Column(8);
                    tIN_Time.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";
                    var tOut_Time = sheet.Column(9);
                    tOut_Time.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";


                });



            return excel;
        }
        #endregion

        #region 路政票证数据导出
        /// <summary>
        /// 在线支付数据导出
        /// </summary> 
        /// <returns></returns>
        public FileDto ExportToExcelByrRoadbillInfos(List<rRoadbillInfos> rrRoadbillInfos)
        {

            var excel =
                CreateExcelPackage("上海停车对账单.xlsx", excelpackage =>
                {
                    var sheet = excelpackage.Workbook.Worksheets.Add(L("rRoadbillInfos"));

                    sheet.OutLineApplyStyle = true;

                    AddHeader(sheet,
                        "票证编号",
                        "支付订单",
                        "支付金额",
                        "支付时间",
                        "支付类型",
                        "订单创建时间",
                        "车牌号码",
                        "进场时间",
                        "出场时间",
                        "出场编号",
                        "进场编号"
                    );

                    AddObject(sheet, 2, rrRoadbillInfos,
                        ex => ex.bussinessId,
                        ex => ex.orderId,
                        ex => ex.payMoney,
                        ex => ex.payTime,
                        ex => ex.payType,
                        ex => ex.gmt_create,
                        ex => ex.tOut_CardNO,
                        ex => ex.tIN_Time,
                        ex => ex.tOut_Time,
                        ex => ex.tOut_Id,
                        ex => ex.tIN_Id
                    );
                    var payTime = sheet.Column(4);
                    payTime.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";
                    var gmt_create = sheet.Column(6);
                    gmt_create.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";

                    var tIN_Time = sheet.Column(8);
                    tIN_Time.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";
                    var tOut_Time = sheet.Column(9);
                    tOut_Time.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";


                });



            return excel;
        }
        #endregion

        #region 路政对账单数据导出
        /// <summary>
        /// 在线支付数据导出
        /// </summary> 
        /// <returns></returns>
        public FileDto ExportToExcelByrRoadStagger(List<rRoadStagger> rrRoadStagger)
        {

            var excel =
                CreateExcelPackage("上海停车对账单.xlsx", excelpackage =>
                {
                    var sheet = excelpackage.Workbook.Worksheets.Add(L("rRoadStagger"));

                    sheet.OutLineApplyStyle = true;

                    AddHeader(sheet,
                        "签约编号",
                        "签约状态",
                        "错峰策略编号",
                        "错峰产品编号",
                        "车牌号码",
                        "车辆类型",
                        "签约起始日期",
                        "签约结束日期" 
                    );

                    AddObject(sheet, 2, rrRoadStagger,
                        ex => ex.signId,
                        ex => ex.signStatus,
                        ex => ex.staggerCode,
                        ex => ex.productId,
                        ex => ex.plateId,
                        ex => ex.vehicleType,
                        ex => ex.staggerDayFrom,
                        ex => ex.staggerDayTo 
                    );
                    var staggerDayFrom = sheet.Column(7);
                    staggerDayFrom.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";
                    var staggerDayTo = sheet.Column(8);
                    staggerDayTo.Style.Numberformat.Format = "yyyy-MM-dd HH:mm:ss";
                     


                });



            return excel;
        }
        #endregion
    }
}
